package com.rpj.stauy.controller;

import com.rpj.stauy.service.MyAiService;
import dev.langchain4j.model.chat.ChatModel;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("propular")
public class PropularQwen {

    @Resource
    private ChatModel chatModel;
    @Resource
    private MyAiService myAiService;

    //http://localhost:9091/propular/qwen
    @GetMapping("/qwen")
    public String propularQwen(@RequestParam(value = "prompt",defaultValue = "你是谁") String prompt){

        return chatModel.chat(prompt);

    }


    //http://localhost:9091/propular/Declarative/qwen
    @GetMapping("Declarative/qwen")
    public String DeclarativeQwen(@RequestParam(value = "prompt",defaultValue = "1加1等于几") String prompt){

        return myAiService.chat(prompt);

    }

}
